﻿using Abp.Domain.Repositories;
using Batman.Cms.Core.Controllers;
using Batman.Jianbei.Forum.Controllers.Posts;
using Batman.Jianbei.Forum.Core.Domains.Dicts;
using Batman.Jianbei.Forum.Core.Domains.Posts;
using Batman.Jianbei.Forum.Services;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace Batman.Jianbei.Forum.Areas.Forum
{
    /// <summary>
    /// 发布帖子
    /// </summary>
    [Area("Forum")]
    public class PublishController : BatmanController<Post>
    {
        public IRepository<Topic, string> topicRepo { get; set; }

        public PostService PostService { get; set; }

        /// <summary>
        /// 发布帖子
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        [Authorize]
        public async Task<ActionResult> post(WeixinH5PublishInput model)
        {
            var wxUserId = User.GetWxUserId();
            var result = await PostService.WeixinH5PublishAsync(model, wxUserId);
            return Json(result);
        }
    }
}